package com.demo2;

import java.util.Date;

/**
 * <p><em>Created on 2021/1/28 9:31</em></p>
 *
 * @author x
 * @since 1.0.1
 */
public class DateFormatterContext {
    private DateFormatterStrategy strategy;
    private DateFormatterImpl formatter = new DateFormatterImpl();

    public DateFormatterContext(DateFormatterStrategy strategy) {
        this.strategy = strategy;
    }

    public void setStrategy(DateFormatterStrategy strategy) {
        this.strategy = strategy;
    }

    public String format(Date date) {
        return this.strategy.doFormat(formatter, date);
    }

}
